/*
 * Copyright (C) 2013 Shanghai Paibo soft Co., Ltd
 *
 * All copyrights reserved by dalinggong.com
 * Any copying, transferring or any other usage is prohibited.
 * Or else, Shanghai Paibo possesses the right to require legal 
 * responsibilities from the violator.
 * All third-party contributions are distributed under license by
 * dalinggong soft Co., Ltd.
 */
package com.dlg.commons.util;

/**
 * 业务编号生成
 * 
 * @author jiangchangcheng 2017年4月5日 上午9:28:02
 * @since JDK 1.7
 */
public enum BusinessNumberUtils {

	instance;

	// 订单编号标识位
	private String BUSINESS_TYPE_ORDER = "R";

	// 账单编号标识位
	private String BUSINESS_TYPE_BILL = "I";

	private String SEPARATOR = "-";

	// 账单明细编号标识位
	private String BUSINESS_TYPE_BILLDETAIL = "E";

	/**
	 * 获取订单业务编号
	 * 
	 * @return
	 */
	public String getOrderBusinessNumber() {
		StringBuilder orderBusinessNumber = new StringBuilder();
		orderBusinessNumber.append(Utils.id()).append(SEPARATOR)
				.append(BUSINESS_TYPE_ORDER).append(SEPARATOR)
				.append(Utils.getUUID()).append(SEPARATOR)
				.append(System.currentTimeMillis());
		return orderBusinessNumber.toString();
	}

	/**
	 * 获取账单业务编号
	 * 
	 * @return
	 */
	public String getBillBusinessNumber() {
		StringBuilder orderBusinessNumber = new StringBuilder();
		orderBusinessNumber.append(Utils.id()).append(SEPARATOR)
				.append(BUSINESS_TYPE_BILL).append(SEPARATOR)
				.append(Utils.getUUID()).append(SEPARATOR)
				.append(System.currentTimeMillis());
		return orderBusinessNumber.toString();
	}

	/**
	 * 获取账单明细业务编号
	 * 
	 * @return
	 */
	public String getBillDetailBusinessNumber() {
		StringBuilder orderBusinessNumber = new StringBuilder();
		orderBusinessNumber.append(Utils.id()).append(SEPARATOR)
				.append(BUSINESS_TYPE_BILLDETAIL).append(SEPARATOR)
				.append(Utils.getUUID()).append(SEPARATOR)
				.append(System.currentTimeMillis());
		return orderBusinessNumber.toString();
	}
}
